/*    */ package andriod.service;
/*    */ 
/*    */ import andriod.dao.PersistDao;
/*    */ import com.jcrj.entity.OAddressbook;
/*    */ import com.jcrj.entity.OOrg;
/*    */ import com.jcrj.entity.OUser;
/*    */ import java.util.List;
/*    */ 
/*    */ public class ArdUserService
/*    */ {
/*    */   private PersistDao persistDao;
/*    */ 
/*    */   public List<OUser> getUserList(String name, int orgId, int page, int pagesize)
/*    */   {
/* 16 */     String hql = "from OUser o where o.del='0' ";
/* 17 */     if ((name != null) && (!"".equals(name.trim()))) {
/* 18 */       hql = hql + " and o.name like '%" + name.trim() + "%'";
/*    */     }
/* 20 */     if (orgId != 0) {
/* 21 */       hql = hql + " and o.orgId = " + orgId;
/*    */     }
/* 23 */     hql = hql + " order by o.px asc";
/* 24 */     return this.persistDao.findForPage(hql, page, pagesize);
/*    */   }
/*    */ 
/*    */   public long getUserCount(String name, int orgId) {
/* 28 */     String hql = "select count(*) from OUser o where o.del='0' ";
/* 29 */     if ((name != null) && (!"".equals(name.trim()))) {
/* 30 */       hql = hql + " and o.name like '%" + name.trim() + "%'";
/*    */     }
/* 32 */     if (orgId != 0) {
/* 33 */       hql = hql + " and o.orgId = " + orgId;
/*    */     }
/* 35 */     return this.persistDao.findForLong(hql);
/*    */   }
/*    */ 
/*    */   public List<OOrg> getOrgList() {
/* 39 */     String hql = "from OOrg o where o.del='0' order by o.pid asc, o.px asc";
/* 40 */     return this.persistDao.find(hql);
/*    */   }
/*    */ 
/*    */   public List<OAddressbook> getBookUserList(String name, int userId, int page, int pagesize)
/*    */   {
/* 45 */     String hql = "from OAddressbook o where userId=" + userId;
/* 46 */     if ((name != null) && (!"".equals(name))) {
/* 47 */       hql = hql + " and o.name like '%" + name.trim() + "%'";
/*    */     }
/* 49 */     hql = hql + " order by o.id desc";
/* 50 */     return this.persistDao.findForPage(hql, page, pagesize);
/*    */   }
/*    */ 
/*    */   public long getBookUserCount(String name, int userId) {
/* 54 */     String hql = "select count(*) from OAddressbook o where userId=" + 
/* 55 */       userId;
/* 56 */     if ((name != null) && (!"".equals(name))) {
/* 57 */       hql = hql + " and o.name like '%" + name.trim() + "%'";
/*    */     }
/* 59 */     hql = hql + " order by o.id desc";
/* 60 */     return this.persistDao.findForLong(hql);
/*    */   }
/*    */ 
/*    */   public PersistDao getPersistDao() {
/* 64 */     return this.persistDao;
/*    */   }
/*    */ 
/*    */   public void setPersistDao(PersistDao persistDao) {
/* 68 */     this.persistDao = persistDao;
/*    */   }
/*    */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     andriod.service.ArdUserService
 * JD-Core Version:    0.6.0
 */